Skip to content

fix: pass missing BlockContext argument to renderTextObject in Sectio…#39494

Open
SamarthShukla17 wants to merge 2 commits intoRocketChat:developfrom
SamarthShukla17:fix/section-block-render-text-object-context
Open

fix: pass missing BlockContext argument to renderTextObject in Sectio…#39494
SamarthShukla17 wants to merge 2 commits intoRocketChat:developfrom
SamarthShukla17:fix/section-block-render-text-object-context

Conversation

@SamarthShukla17
Copy link

@SamarthShukla17 SamarthShukla17 commented Mar 10, 2026

Proposed changes (including videos or screenshots)

renderTextObject in SectionBlock.tsx was being called with 2 arguments
instead of the required 3 after the refactor in #39268. This caused a
TypeScript build error on develop.

Changes:

  • Pass UiKit.BlockContext.NONE as the third argument to renderTextObject
  • Change import type * as UiKit to import * as UiKit since BlockContext
    is a runtime const object, not just a type

Issue(s)

Closes #39493

Steps to test or reproduce

  1. Checkout this branch
  2. Run yarn dev
  3. Verify @rocket.chat/fuselage-ui-kit compiles with 0 errors
    (previously showed: error TS2554: Expected 3 arguments, but got 2)

Further comments

Every other call to renderTextObject in the codebase already passes
UiKit.BlockContext.NONE as the third argument — see ButtonElement.tsx,
CalloutBlock.tsx, InputBlock.tsx etc. This brings SectionBlock.tsx
in line with the rest.

Summary by CodeRabbit

Bug Fixes

  • Fixed a rendering issue where section block text objects were not properly receiving required context information during text processing. This fix resolves potential display inconsistencies and ensures proper functionality across text rendering operations. The patch ensures that all text elements display correctly and behave consistently throughout the UI Kit library and its components.

Copilot AI review requested due to automatic review settings March 10, 2026 00:41
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Mar 10, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Mar 10, 2026

🦋 Changeset detected

Latest commit: e784746

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/meteor Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/ui-voip Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c3eab6cf-8e17-4798-988e-db8a939a33ac

📥 Commits

Reviewing files that changed from the base of the PR and between c987432 and b9eac77.

📒 Files selected for processing (2)
  • .changeset/soft-fans-hug.md
  • packages/fuselage-ui-kit/src/blocks/SectionBlock.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Agent
  • GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • packages/fuselage-ui-kit/src/blocks/SectionBlock.tsx
🧠 Learnings (1)
📚 Learning: 2025-11-17T15:07:13.273Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37398
File: packages/fuselage-ui-kit/src/surfaces/FuselageSurfaceRenderer.tsx:357-363
Timestamp: 2025-11-17T15:07:13.273Z
Learning: In packages/fuselage-ui-kit/src/surfaces/FuselageSurfaceRenderer.tsx, IconElement is a presentational, non-actionable element that does not require wrapping in AppIdProvider, similar to plain_text and mrkdwn renderers. Only actionable elements (those with actions, actionId, or interactive behavior) should be wrapped in AppIdProvider.

Applied to files:

  • packages/fuselage-ui-kit/src/blocks/SectionBlock.tsx
🔇 Additional comments (2)
.changeset/soft-fans-hug.md (1)

1-5: LGTM.

The changeset is correctly scoped as a patch and documents the fix clearly.

packages/fuselage-ui-kit/src/blocks/SectionBlock.tsx (1)

2-2: Reconsider BlockContext.NONE for section text rendering.

Test specifications in packages/ui-kit/src/surfaces/*/UiKitParser*.spec.ts render section block text and fields using BlockContext.SECTION (lines 41–44), but this implementation uses BlockContext.NONE. While other blocks in fuselage-ui-kit consistently use NONE, the discrepancy between the test contract and the runtime behavior suggests the chosen enum value should be verified. Confirm whether section block text should intentionally deviate from the test specification pattern.


Walkthrough

Fixes a TypeScript compilation error in SectionBlock.tsx by converting the UiKit import from type-only to runtime import and passing the missing BlockContext argument to the renderTextObject function call. Includes a changeset entry documenting the fix.

Changes

Cohort / File(s) Summary
Changeset Documentation
.changeset/soft-fans-hug.md
New patch changeset entry for @rocket.chat/fuselage-ui-kit documenting the BlockContext argument fix in SectionBlock.
SectionBlock Bug Fix
packages/fuselage-ui-kit/src/blocks/SectionBlock.tsx
Changed UiKit import from type-only to runtime import and updated renderTextObject call to pass the missing third BlockContext argument as UiKit.BlockContext.NONE.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title clearly and concisely summarizes the main change: passing the missing BlockContext argument to renderTextObject in SectionBlock.
Linked Issues check ✅ Passed All code changes directly address the requirements in issue #39493: passing UiKit.BlockContext.NONE as the third argument and changing the import from type-only to runtime import.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the TypeScript error in SectionBlock.tsx; no unrelated modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Fuselage UI Kit SectionBlock rendering to explicitly pass a BlockContext when calling surfaceRenderer.renderTextObject, and adds a changeset to release the fix as a patch.

Changes:

  • Update SectionBlock to pass an explicit BlockContext to renderTextObject.
  • Switch @rocket.chat/ui-kit import in SectionBlock from type-only to value import to access BlockContext at runtime.
  • Add a patch changeset documenting the fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/fuselage-ui-kit/src/blocks/SectionBlock.tsx Passes an explicit BlockContext to renderTextObject for section text rendering.
.changeset/soft-fans-hug.md Declares a patch release note for the SectionBlock context argument change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 29 to 32
{text && (
<Box is='span' fontScale='p2' color='default'>
{surfaceRenderer.renderTextObject(text, 0)}
{surfaceRenderer.renderTextObject(text, 0, UiKit.BlockContext.NONE)}
</Box>
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SectionBlock is rendering the section's text with BlockContext.NONE. For a text object inside a section block, the correct semantic context is BlockContext.SECTION (this is how other renderers in the repo render section text), which keeps behavior consistent and avoids future context-specific rendering differences.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! However, every other block in this codebase
(CalloutBlock.tsx, InputBlock.tsx, ImageBlock.tsx, ActionsBlock.tsx,
PreviewBlock.tsx, InfoCard.tsx, and even SectionBlock.Fields.tsx)
uses BlockContext.NONE for renderTextObject calls. Using BlockContext.NONE
keeps this consistent with the rest of the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Missing BlockContext argument in renderTextObject call in SectionBlock

2 participants